package com.losers;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class PictureForm extends Activity {
	public static final int REQUEST_PICTURE_DATA = 12345;
	
	public static Bitmap bmp = null;
	
	ImageView imageView;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
			
		setContentView(R.layout.picture);
		
		imageView = (ImageView)findViewById(R.id.ImageViewBigPicture);
		imageView.setImageBitmap(bmp);
	}
	
	public void onTakePictureClicked(View v) {
		// Start camera activity
		Intent intent = new Intent(PictureForm.this, CameraActivity.class);
		startActivityForResult(intent, REQUEST_PICTURE_DATA);
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (requestCode == REQUEST_PICTURE_DATA) {
			// camera activity has ended, update image view
           	if (bmp != null)
         		imageView.setImageBitmap(bmp);
        }
    }
	
	public void onUsePictureClicked(View v) {
		finish();
	}
	
	public void onBackClicked(View v) {
		bmp = null;
		finish();
	}
}
